package ua.edu.test.banks;


import ua.edu.test.builder.AbstractOperations;
import ua.edu.test.builder.BankDataModel;
import ua.edu.test.builder.OperationNotAllowedException;

public class AvalBank implements AbstractOperations {

    // константа номера
    public static final String AVAL_PHONE = "10901";

    @Override
    public String getBalance(BankDataModel model) {
        return new StringBuilder().append("A").append(" ").append(model.getAccountNumber()).append(" ").append(model.getAccessCode()).toString();
    }

    @Override
    public String blockCard(BankDataModel model) {
        return new StringBuilder().append("OFF").append(" ").append(model.getCardNumber()).append(" ").append(model.getAccessCode()).toString();
    }

    @Override
    public String getReport(BankDataModel model) {
        throw new OperationNotAllowedException();
    }

    @Override
    public String moneyTransfer(BankDataModel model) {
        throw new OperationNotAllowedException();
    }

    @Override
    public String unblockCard(BankDataModel model) {
        throw new OperationNotAllowedException();
    }

    @Override
    public String mobileTransfer(BankDataModel model) {
        throw new OperationNotAllowedException();
    }

    @Override
    public String getBankPhone() {
        return AVAL_PHONE;
    }

    public boolean checkAvalNumber(String incomingNumber){
        return incomingNumber.equals(AVAL_PHONE);
    }
}
